module.exports = {
    /*
     ** Headers of the page
     */
    offline: false,
    head: {
        titleTemplate: '%s',
        meta: [{
            charset: 'utf-8'
        }, {
            name: 'viewport',
            content: 'width=device-width, initial-scale=1'
        }],
        link: [{
            rel: 'icon',
            type: 'image/x-icon',
            href: '/favicon.ico'
        },]
    },
    /*
     ** Global CSS
     */
    css: [
        '~assets/css/index.css',
        '~assets/css/base/iconfont.css',
        'element-ui/lib/theme-default/index.css'
    ],
    build: {
        filenames: {
            manifest: 'manifest.[hash].js',
            css: 'app.[hash].css', // default: style.css
            vendor: 'vendor.[hash].js', // default: vendor.bundle.js
            app: 'app.[chunkhash].js' // default: nuxt.bundle.js
        },
        vendor: ['lodash', 'babel-polyfill'],
        babel: {
            "presets": ["es2015", "stage-2"],
            "plugins": [
                "transform-runtime", ["component", [{
                    "libraryName": "element-ui",
                //"styleLibraryName": "theme-default"
                }]],

                ["transform-vue-jsx"]
            ],
            "comments": false
        },
        loaders: [{
            test: /\.css$/,
            loader: 'vue-style-loader!css-loader'
        }, {
            test: /\.(png|jpe?g|gif|svg)$/,
            loader: 'url-loader',
            query: {
                limit: 1000, // 1KO
                name: 'img/[name].[hash:7].[ext]'
            }
        }, {
            test: /\.(woff?|eot|ttf|svg)(\?.*)?$/,
            loader: 'url-loader',
            query: {
                limit: 1000, // 1 KO
                name: 'fonts/[name].[hash:7].[ext]'
            }
        }],
        postcss: [
            require('autoprefixer')({
                browsers: ['last 3 versions']
            })
        ],
        // extend (config, { dev }) {
        //   if (dev) {
        //     config.devtool = (dev ? 'eval-source-map' : false)
        //   }
        // }

        //TODO 正式环境
        //publicPath: '//ads-loon.oss-cn-hangzhou.aliyuncs.com/nuxt/',
    },
    /*
     ** Customize the progress-bar color
     */
    loading: {
        color: '#0686f9'
    },
    middleware: ['auth'],
    env: {
        isDev: true //TODO true为香港测试环境，false为线上正式环境
    }
};